
function day(){
    var dataName = [];
    var dataValue = [];
    //===========================柱状图========================
    var option = {
        title: {
            text:"方法耗时统计/一天",
        },
        legend: {
            data: [],
        },
        grid: {
            x: '15%', //相当于距离左边效果:padding-left
            // y: '30%',  //相当于距离上边效果:padding-top
        },
        xAxis: {
            type: 'value',
        },
        yAxis: {
            type: 'category',
            data: dataName,
        },
        series: [
            {
                barWidth: 20,
                type: 'bar',
                data: dataValue,
                itemStyle: {
                    normal: {
                        color: function(params) {
                            //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                            var colorList = ['#ff6666','#FFCE54', '#4FC1E9', '#D770AD', '#AC92EC','#8CC152', '#66CCCC','#656D78'];
                            return colorList[params.dataIndex]
                        },
                        label: {
                            show: true,
                            position: 'right',
                            textStyle: {
                                color: 'black',
                                fontSize: 12
                            }
                        }
                    }
                }
            }
        ]
    };

    //===========================饼状图========================
    var option2 = {
        title: {
            text: '',
            left:'center'
        },
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        color: ['#ff6666', '#FFCE54', '#4FC1E9', '#D770AD', '#AC92EC', '#8CC152', '#66CCCC', '#656D78'],
        stillShowZeroSum: false,
        series: [
            {
                name: '耗时分布',
                type: 'pie',
                radius: '70%',
                data: [],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(128, 128, 128, 0.5)'
                    }
                }
            }
        ]
    };

    var myBarChart = echarts2.init(document.getElementById('dayCountByBar'));
    var myPieChart = echarts2.init(document.getElementById('dayCountByPie'));
    myBarChart.showLoading({
        text : '数据加载中...',  //加载时候的文本
        color:'green',      //加载时候小圆圈的颜色
        textColor:'white',  //加载时候文本颜色
        maskColor:'#082042' //加载时候的背景颜色
    });
    myPieChart.showLoading({
        text : '数据加载中...',  //加载时候的文本
        color:'green',      //加载时候小圆圈的颜色
        textColor:'white',  //加载时候文本颜色
        maskColor:'#082042' //加载时候的背景颜色
    });
    setInterval(function () {
        var requestUrl = serverPre + "/manager/scs/v2/methodCron/oneday";
        $.ajax({
            url: requestUrl,
            type: 'POST',
            contentType: 'application/json',
            headers: {"token": getCookie("token")},
            success: function (res) {
                for (i = 0; i < res.length; i++) {
                    dataName[i] = res[i].name;
                    dataValue[i] = res[i].value;
                    option2.series[0].data[i] = {value: res[i].value, name: res[i].name};
                }
                myBarChart.setOption(option, true);
                myBarChart.hideLoading();
                myPieChart.setOption(option2, true);
                myPieChart.hideLoading();
            },
            error: function (err) {
                errorMsg(err);
            }
        });
    }, 1000 * 60 * 30);

}
